package pers.liyan.shi.springcloud.service;

import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;
import pers.liyan.shi.springcloud.domain.Dept;
import pers.liyan.shi.springcloud.service.fallback.DeptClientServiceFallbackFactory;

import java.util.List;

/**
 * feign 接口
 * @author shily
 * @date 2019/5/23 15:03
 */
@FeignClient(name = "SPRINGCLOUD-MICROSERVICE-PROVIDER-DEPT", path = "/dept", fallbackFactory = DeptClientServiceFallbackFactory.class)
public interface DeptClientService {


    @GetMapping("/")
    List<Dept> getAll();

    @GetMapping("/{deptNo}")
    Dept getByDeptNo(@PathVariable("deptNo") Long deptNo);

    @PostMapping("/")
    Dept addDept(Dept dept);

    @PutMapping("/")
    Dept updateDept(Dept dept);

    @DeleteMapping("/{deptNo}")
    int deleteByDeptNo(@PathVariable("deptNo") Long deptNo);

}
